import { defineStore } from "pinia"
import {getCart} from '../api/service/cart.js'
const useCartStore=defineStore('cart',{
  state:()=>{
    return {   //响应式的数据源
      badge:0
    }
  },
  actions:{
    async initBadge(){
     const {data}= await getCart()  //获取购物车数据
    //  console.log(data);
     this.badge=data.length
    }
  },
  getters:{

  }

})

export default useCartStore